import request from '@/utils/request'

export function getProblemList(query) {
  return request({
    url: '/practice/problem/listProblem',
    method: 'get',
    params: query
  })
}

export function getProblemListAdmin(query) {
  return request({
    url: '/practice/problem/listProblemAdmin',
    method: 'get',
    params: query
  })
}

export function getProblemById(query) {
  return request({
    url: '/practice/problem/problemById',
    method: 'get',
    params: query
  })
}

export function getClassifyListCascader() {
  return request({
    url: '/practice/classify/listCascader',
    method: 'get'
  })
}

export function addProblem(data) {
  return request({
    url: '/practice/problem/addProblem',
    method: 'post',
    data
  })
}

export function updateProblem(data) {
  return request({
    url: '/practice/problem/updateProblem',
    method: 'post',
    data
  })
}

export function addProblemImage(data) {
  return request({
    url: '/practice/problem/addProblemImage',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    data
  })
}

export function deleteProblemImage(query) {
  return request({
    url: '/practice/problem/deleteProblemImage',
    method: 'post',
    params: query
  })
}

export function updateDefunct(query) {
  return request({
    url: '/practice/problem/updateDefunct',
    method: 'post',
    params: query
  })
}

export function deleteProblem(query) {
  return request({
    url: '/practice/problem/deleteProblem',
    method: 'delete',
    params: query
  })
}

export function getProblemAdminById(query) {
  return request({
    url: '/practice/problem/problemAdminById',
    method: 'get',
    params: query
  })
}

export function getTestData(query) {
  return request({
    url: '/practice/problem/getTestData',
    method: 'get',
    params: query
  })
}

export function deleteTestData(query) {
  return request({
    url: '/practice/problem/deleteTestData',
    method: 'delete',
    params: query
  })
}

export function addTestData(data) {
  return request({
    url: '/practice/problem/addTestData',
    method: 'post',
    data
  })
}

export function updateTestDataByName(data) {
  return request({
    url: '/practice/problem/updateTestDataByName',
    method: 'post',
    data
  })
}

export function getTestDataByName(query) {
  return request({
    url: '/practice/problem/getTestDataByName',
    method: 'get',
    params: query
  })
}

export function simpleProblemPage(query) {
  return request({
    url: '/practice/problem/simpleProblemPage',
    method: 'get',
    params: query
  })
}
